package com.kingdee.eas.xr.helper;

/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.


import java.util.*;

public class EcCollectionUtil
{

    public EcCollectionUtil()
    {
    }

    public static boolean isEmpty(Collection col)
    {
        return col == null || col.isEmpty();
    }

    public static boolean isNotEmpty(Collection col)
    {
        return !isEmpty(col);
    }

    public static Collection union(Collection col1, Collection col2)
    {
        List list = new ArrayList();
        list.addAll(col1);
        list.addAll(col2);
        Set set = new LinkedHashSet(list);
        list.clear();
        list.addAll(set);
        return list;
    }

    public static Collection unionAll(Collection col1, Collection col2)
    {
        List list = new ArrayList();
        list.addAll(col1);
        list.addAll(col2);
        return list;
    }

    public static Collection unionSample(Collection col1, Collection col2)
    {
        List list = new ArrayList();
        list.addAll(col1);
        list.removeAll(col2);
        list.addAll(col2);
        return list;
    }

    public static Collection union(Collection colArr[])
    {
        List list = new ArrayList();
        int length = colArr.length;
        Collection col = null;
        for(int i = 0; i < length; i++)
        {
            col = colArr[i];
            if(isNotEmpty(col))
                list.addAll(col);
        }

        Set set = new LinkedHashSet(list);
        list.clear();
        list.addAll(set);
        return list;
    }

    public static Collection unionAll(Collection colArr[])
    {
        List list = new ArrayList();
        int length = colArr.length;
        Collection col = null;
        for(int i = 0; i < length; i++)
        {
            col = colArr[i];
            if(isNotEmpty(col))
                list.addAll(col);
        }

        return list;
    }

    public static void clearDuplicate(Collection collection)
    {
        if(isNotEmpty(collection))
        {
            Set set = new LinkedHashSet(collection);
            collection.clear();
            collection.addAll(set);
        }
    }

    public static void clearNull(Collection collection)
    {
        if(isNotEmpty(collection))
        {
            List nullList = new ArrayList();
            nullList.add(null);
            collection.removeAll(nullList);
        }
    }

    public static void clearDuplicateAndNull(Collection collection)
    {
        if(isNotEmpty(collection))
        {
            Set set = new LinkedHashSet(collection);
            set.remove(null);
            collection.clear();
            collection.addAll(set);
        }
    }
}


/*
	DECOMPILATION REPORT

	Decompiled from: F:\qs\lib\industry\ec_common-server.jar
	Total time: 15 ms
	Jad reported messages/errors:
	Exit status: 0
	Caught exceptions:
*/